import time
from week3_93.Page.Page1 import Page1
from selenium.webdriver.common.by import By

class Page2(Page1):
    search_loc = (By.ID, 'wd')
    def search(self):
        self.send_keys(self.search_loc, '五粮液')

    searchbtn_loc = (By.XPATH, '/html/body/div[4]/div/div[2]/div[1]/form/input[2]')
    def searchbtn(self):
        self.click(self.searchbtn_loc)

    img_loc = (By.XPATH, '/html/body/div[6]/div/div[2]/div[5]/ul/li[1]/div[2]/div[1]/a/img')
    def img(self):
        self.click(self.img_loc)

    add_loc = (By.ID, 'addToCartForDetail')
    def add(self):
        self.click(self.add_loc)

    def jiuxian_02(self):
        self.jiuxian_01()
        self.search()
        time.sleep(2)
        self.searchbtn()
        self.img()
        self.new_window()
        time.sleep(2)
        self.add()

